package main

import "fmt"

/*func swap(a int, b int){
    var c int
    c = a
    a = b
    b = c
}*/

func swap(a *int, b *int){
    var c int
    c = *a
    *a = *b
    *b = c
}

func main(){
    a := 10
    b := 20

    //swap(a, b)

    swap(&a, &b)

    fmt.Println("a = ",a,",b = ",b);

    // 一级指针
    var c *int
    c = &a

    fmt.Println(&a);
    fmt.Println(c);

    // 二级指针
    var d **int
    d = &c

    fmt.Println(&c);
    fmt.Println(d);
}